import React,{useState,useEffect} from 'react'
import './Indexmanagement.css'
import { Input , Button,Modal } from 'antd';
import App from './Tablelb'
import Add from './ModalAdd'
import http from '../../../services/http';

export default function IndexManagement() {
  const onChange=(ev)=>{
    console.log(ev.target.value)
    setStan_name(ev.target.value);
  }
  
  const [stan_name,setStan_name]=useState('');
  const [list,setList]=useState('');
  const [msg,setMsg]=useState([])

  const searchbtn=()=>{
    http({
      url:'/searchstandard',
      data:{
        stan_name:stan_name
      }
    }).then((res)=>{
      //console.log(res);
      setList(res);
    })
  }

  const send=(msg)=>{
    console.log('msg',msg)
    setMsg(msg);
  }
  
  return (
    <div>
      <div id="contitle">标准指标管理</div>
      <div id="con2">
        <div id="contitle2"><span id="spancon">数据筛选</span></div>
        <div id="coninp">
            <div id="inpsearch">
                <label id="inp2">输入查询：</label>
                <Input id="inp1" values={stan_name} placeholder="指标名称" allowClear onChange={onChange} />
            </div>
        <div id="searchbtn">
            <Button onClick={searchbtn} id="searchbtn1" type="primary">查询</Button>
            <Button>重置</Button>
        </div>
        </div>
      </div>
      <div id="listbtn">
        <Add onSend={send}/>
      </div>
      <div id="contable">
          <App list={list} msg={msg}/>
      </div>
    </div>
  )
}
